package org.aeon.colorfulplanebattle.view.components;

import org.aeon.colorfulplanebattle.view.GameState;

import javax.swing.*;
import java.awt.*;

import static org.aeon.colorfulplanebattle.constant.GameBasisConstant.*;

/**
 * @author: MissingAeon
 * @date: 2024/1/12 11:27
 * @description: 时钟
 */
public class Process extends JLabel {
    private final GameState gameState;

    public Process(GameState gameState) {
        this.gameState = gameState;
        this.setFont(SCOREBOARD_FONT);
        this.setForeground(new Color(190, 170, 170, 150));
        this.setBounds(WINDOW_WIDTH - 200, 60, 200, 30);
        gameState.put("process", 0);
    }

    @Override
    protected void paintComponent(Graphics g) {
        this.setText(PROCESS_PREFIX + gameState.get("process"));
        super.paintComponent(g);
    }
}
